package com.woniu.aimd.controller;

import com.woniu.aimd.service.impl.ChatService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

import java.util.Map;

@RestController
@RequestMapping("/search")
@CrossOrigin
public class SearchWebController {
    @Resource
    private ChatService chatService;
    //, produces = MediaType.TEXT_EVENT_STREAM_VALUE
    @PostMapping(value = "/query")
    public Flux<String> query(@RequestBody Map<String, String> request) {
        return chatService.searchWeb(request.get("query"));
    }
}
